import 'message_model.dart';

class MessageListModel {
  int? lastId;
  List<MessageModel>? messages;

  MessageListModel({this.lastId, this.messages});

  factory MessageListModel.fromJson(Map<String, dynamic> json) =>
      MessageListModel(
        lastId: json['last_id'] as int?,
        messages: (json['messages'] as List<dynamic>?)
            ?.map((e) => MessageModel.fromJson(e as Map<String, dynamic>))
            .toList(),
      );

  Map<String, dynamic> toJson() => {
        'last_id': lastId,
        'messages': messages?.map((e) => e.toJson()).toList(),
      };
}
